#!/bin/sh
#
# Startup script for mlapd
#
# chkconfig: - 99 01
# description: This script starts/stops mlapd
#

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

progname=mlapd.py

# PLEASE change the following two variables to your correct path
pidfile=/home/mlapd/development/svn/trunk/mlapd/var/run/mlapd.pid
mlapd=/home/mlapd/development/svn/trunk/mlapd/sbin/mlapd.py
[ -f $mlapd ] || exit 0

RETVAL=0

# See how we were called.
case "$1" in
  start)
        echo -n "Starting $progname: "
        daemon $mlapd $OPTIONS
	RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/mlapd
        ;;
  stop)
        if test "x`cat $pidfile`" != x; then
            echo -n "Shutting down $progname: "
            killproc -p $pidfile $progname
        fi
	RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dnsmasq $pidfile
        ;;
  status)
	status -p $pidfile $progname
	RETVAL=$?
	;;
  restart)
	$0 stop
	$0 start
	RETVAL=$?
	;;
  *)
        echo "Usage: $0 {start|stop|restart|status}"
        exit 1
esac

exit $RETVAL
